# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Clément DEMOULINS <clement@archivel.fr>

pkgname=python-networkx
pkgver=3.2.1
pkgrel=1
pkgdesc='Python package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks.'
arch=('any')
license=('BSD')
url="https://networkx.org/"
depends=('python-numpy' 'python-scipy' 'python-matplotlib' 'python-pandas')
optdepends=('python-lxml: for GraphML XML format'
            'python-pydot: for graph drawing and graph layout algorithms via GraphViz'
            'python-yaml: for YAML format reading and writing'
            'python-sympy: for polynomial algorithms')
# python-pygraphviz: for graph drawing and graph layout algorithms via GraphViz
makedepends=('python-build' 'python-installer' 'python-wheel')
checkdepends=('python-pytest-runner' 'python-lxml' 'python-pydot' 'python-yaml')
source=("https://github.com/networkx/networkx/archive/networkx-$pkgver.tar.gz")
sha512sums=('4e64352c5b2746ba5722d9ac877ca13981cf0d109df5403d8f314ed07bb6c12cd0065217a3b13daefb62f5fc74ad2bc28db2839b0d57bca8a975a9da218fadb7')

build() {
  cd networkx-networkx-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd networkx-networkx-$pkgver
  pytest -v
}

package() {
  cd networkx-networkx-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -D -m 644 LICENSE.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.txt
  mkdir -p "$pkgdir"/usr/share/doc/$pkgname
  cp -r examples "$pkgdir"/usr/share/doc/$pkgname
}
